<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
%>
<jsp:include page="../include/admin/adminHeader.jsp" />
<jsp:include page="../include/admin/adminNavigator.jsp" />

<script>
$(function() {
    $("#editForm").submit(function() {
        if (!checkEmpty("name", "产品名称"))
            return false;
            if (!checkEmpty("subTitle", "小标题"))
                return false;
        if (!checkNumber("originalPrice", "原价格"))
            return false;
        if (!checkNumber("promotePrice", "优惠价格"))
            return false;
        if (!checkInt("stock", "库存"))
            return false;
        return true;
    });
});
</script>

<title>编辑分类</title>

<div class="workingArea">
	<ol class="breadcrumb">
      <li><a href="admin_category_list">所有分类</a></li>
      <li><a href="admin_product_list?category.id=${product.category.id}">${product.category.name}</a></li>
      <li class="active">${product.name}</li>
      <li class="active">编辑产品</li>
    </ol>
	
	<div class="panel panel-warning editDiv">
        <div class="panel-heading">编辑产品</div>
        <div class="panel-body">
            <form method="post" id="editForm" action="admin_product_update">
                <table class="editTable">
                    <tr>
                        <td>产品名称</td>
                        <td>
                        	<input id="name" name="product.name" value="${product.name}" type="text" class="form-control">
                        </td>
                    </tr>
                    <tr>
                        <td>产品小标题</td>
                        <td>
                        	<input id="subTitle" name="product.subTitle" type="text" value="${product.subTitle}" class="form-control">
                        </td>
                    </tr>
                    <tr>
                        <td>原价格</td>
                        <td><input id="originalPrice" value="${product.originalPrice}" name="product.originalPrice" type="text"
                            class="form-control"></td>
                    </tr>
                    <tr>
                        <td>优惠价格</td>
                        <td><input id="promotePrice"  value="${product.promotePrice}" name="product.promotePrice" type="text"
                            class="form-control"></td>
                    </tr>
                    <tr>
                        <td>库存</td>
                        <td><input id="stock"  value="${product.stock}" name="product.stock" type="text"
                            class="form-control"></td>
                    </tr>
                                         
                    <tr class="submitTR">
                        <td colspan="2" align="center">
                        <input type="hidden" name="product.id" value="${product.id}">
                        <input type="hidden" name="product.category.id" value="${product.category.id}">
                        <button type="submit" class="btn btn-success">提 交</button></td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>